
float distance_form(__global float *xx, __global float *yy, int num)
{
	int i;
	float sum = 0;

	for(i = 0; i < num; i++)
	{
		sum = (xx[i] - yy[i]) * (xx[i] - yy[i]) + sum;
	}

	return sqrt(sum);
}

__kernel void MutualInfo(__global float *info, __global float *arr, int M, int NUM_ROWS)
{

	const int idx = get_global_id(0);

	__global float *pRowx, *pRowy;
	pRowx = &arr[idx * M];

	if (idx < NUM_ROWS)
	{
		int jdx;
		for (jdx = idx; jdx < NUM_ROWS; jdx++)
		{
	
			pRowy = &arr[jdx * M];
			info[idx * NUM_ROWS + jdx] = distance_form(pRowx, pRowy, M);
			info[jdx * NUM_ROWS + idx] = info[idx * NUM_ROWS + jdx];
		}
	}
}


